package com.example.demo_music;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.TextView;

public class MyReceiver extends BroadcastReceiver {

    private DaiLi1 d1;
    private DaiLi2 d2;
    public void onReceive(Context context, Intent intent) {
        String songartist = intent.getStringExtra("songartist");
        String songtitle = intent.getStringExtra("songtitle");
        d1.artistSet(songartist);
        d2.titleSet(songtitle);
        System.out.println(songartist);
    }
    interface DaiLi1{
        void artistSet(String artist);
    }
    public void sendSong(DaiLi1 d){
        d1 = d;
    }
    interface DaiLi2{
        void titleSet(String title);
    }
    public void sendSong(DaiLi2 d){
        d2 = d;
    }

}
